home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / fido / mmail.000 / mmail / mmail.0.1 / interface / interface.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-27  |  5.4 KB  |  264 lines

  1. /*
  2.  * MultiMAIL offline mail reader
  3.  * 
  4.  
  5.    Written by Kolossvary Tamas (thomas@vma.bme.hu)
  6.  
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 2, or (at your option)
  10.    any later version.
  11.  
  12.    This program is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with this program; if not, write to the Free Software
  19.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #ifndef INTERFACE_H
  22. #define INTERFACE_H
  23.  
  24. #define REPLY_AREA 1
  25.  
  26. //#define SOUND_EFFECTS
  27.  
  28. #include <stdio.h>
  29. #include <string.h>
  30. #include <stdlib.h>
  31. #include <ncurses.h>
  32. #include "../mmail/mmail.h"
  33. #include "tagline.h"
  34.  
  35. enum direction { UP, DOWN, PGUP, PGDN, HOME, END };
  36. enum statetype { packetlist, arealist, threadlist, letterlist, letter, 
  37.          letter_help, littlearealist};
  38. extern int WarningWindow(char *, char *, char *);
  39. extern void screen_init(int);
  40.  
  41. class ListWindow
  42. {
  43.  public:
  44.      ListWindow();
  45.      virtual void MakeActive(void){};
  46.     virtual void Delete(void){};    
  47.     virtual    void Draw(void){};    //refreshes the window
  48.     virtual void ReDraw(void);    //apply touchwin on the windoz
  49.     void Move(direction);    //scrolloz
  50.  protected:
  51.       int    list_max_y;
  52.     int    list_max_x;
  53.     virtual int    NumOfItems(void){return 0;};
  54.     WINDOW     *list;
  55.     int    position;    //the first element in the window
  56.     int    active;        //this is the highlited    
  57. };
  58.  
  59. class Interface
  60. {
  61.  public:
  62.      Interface(int);
  63.     void init(void);
  64.      void select(void);
  65.      int back(void);  //returns 1 if we have to quit the program
  66.     void DOWN_ARROW(void); //downarrow is pressed
  67.     void UP_ARROW(void); //uparrow pressed
  68.      void RIGHT_ARROW(void);
  69.      void LEFT_ARROW(void);
  70.     void HOME_KEY(void);     //HOME key pressed
  71.     void END_KEY(void);
  72.     void PGUP_KEY(void);
  73.     void PGDN_KEY(void);
  74.     void help(void);
  75.      void search(void);
  76.     void ANY_KEY(void);
  77.     void enterletter(char);
  78.     void save(void);
  79.     void kill(void);
  80.     void reedit(void);
  81.     void change_prop(void);
  82.     void addressbook(void);
  83.     void ReplyPacket(void);      //warns & call create_reply_packet
  84.     void create_reply_packet();    //do the job
  85.     statetype active(void);
  86.     void set_dontcallEnterLetter(void);
  87.  private:
  88.      statetype     state;    
  89.     int        unsaved_reply;
  90.     int        dontcallEnterLetter; 
  91.     char        Key;
  92. };
  93.  
  94. class Welcome
  95. {
  96.  public:
  97.      void MakeActive(void);
  98.      void Delete(void);
  99.     void ReDraw(void);
  100.  private:
  101.      WINDOW *window;
  102. };
  103.  
  104. class Person
  105. {
  106.  public:
  107.     Person(void);
  108.      char         name[30];
  109.      net_address     netmail_addr;
  110.      Person        *next;
  111. };
  112.  
  113. class AddressBook : public ListWindow
  114. {
  115.  public:
  116.     AddressBook(void);
  117.     void MakeActive(int NOENTER = 0);
  118.  private:
  119.     void AddressFromLetter(void);
  120.     void Draw(void);
  121.       int NumOfItems(void);
  122.      void ReadFile(void);
  123.      void DestroyChain(void);
  124.      void SetLetterThings(void);
  125.  
  126.     Person     head;
  127.     Person    *curr;
  128.     int    NumOfPersons;
  129.     Person  *highlighted;
  130. };
  131.  
  132. class TaglineWindow : public ListWindow
  133. {
  134.  public:
  135.      TaglineWindow(void);
  136.  private:
  137.     void ReadFile(void);
  138.     void DestroyChain(void);
  139.      void Draw(void);
  140.     void EnterTagline(void);
  141.     void RandomTagline(void);
  142.      int NumOfItems(void);
  143.       char *getTextOf(int);     
  144.  
  145.       int NumOfTaglines;
  146.     tagline head;
  147. };
  148.  
  149. class LittleAreaListWindow : public ListWindow
  150. {
  151.  public:
  152.      LittleAreaListWindow(char);
  153.      virtual ~LittleAreaListWindow(void);
  154.      void Draw(void);
  155.     int NumOfItems(void);
  156.  private:
  157.      char key;
  158. };
  159.  
  160. class AreaListWindow : public ListWindow
  161. {
  162.  public:
  163.      void MakeActive(void); 
  164.      void Delete(void);
  165.      void Draw(void);
  166.     void ReDraw();
  167.     void FirstUnread();
  168.      int NumOfItems(void);
  169.      void Reset_areaList(void);
  170.  private:
  171.      WINDOW     *info;
  172. };
  173.  
  174. class PacketListWindow : public ListWindow
  175. {
  176.  public:
  177.     PacketListWindow(void);
  178.      void MakeActive(void);
  179.      void Delete(void);
  180.      void Draw(void);
  181.     int NumOfItems(void);
  182.  private:
  183. };
  184.  
  185. class LetterListWindow : public ListWindow
  186. {
  187.  public:
  188.      LetterListWindow(void);
  189.     void MakeActive(void);
  190.     void Delete(void);
  191.     void Draw(void);
  192.     void Save(void);
  193.     void FirstUnread(void);
  194.     int NumOfItems(void);
  195. };
  196.  
  197. class Line
  198. {
  199.  public:
  200.      Line(void);    
  201.     char *text;
  202.     Line *next;
  203. };
  204.  
  205. class LetterWindow
  206. {
  207.  public:
  208.      void MakeActive(void);
  209.      void Delete(void);
  210.      void Draw(void);
  211.     void ReDraw(void);
  212.     void Next(void);
  213.     void Previous(void);
  214.     void Move(direction);
  215.     void Save(void);
  216.     void EnterLetter(void);
  217.     void MakeChain(void);
  218.     net_address PickNetAddr(void);
  219.     void DestroyChain(void);
  220.     void write_to_file(FILE *, int NEED_HEADER = 1);
  221.     void set_Letter_Params(int, char);
  222.     void set_Letter_Params(net_address *, char[30]);
  223.     void set_Tagline(char *);
  224.     void set_columns(int);
  225.  private:    
  226.      WINDOW    *header;
  227.      WINDOW    *text;
  228.      Line     head;
  229.      Line    *curr;
  230.      int     letter_in_chain; //0 = no letter in chain
  231.     unsigned int    position; //which row is the first in the text window
  232.     unsigned int    NumOfLines;
  233.     int    dont_inc_pos;
  234.     int    x, y; //dimensions of the window, set by MakeActive
  235.     int     replyto_area;
  236.     char     key;
  237.     int    columns;
  238.     char     tagline[80];
  239.     net_address NM;
  240.     char    To[30];
  241. };
  242.  
  243. class HelpWindow
  244. {
  245.  public:
  246.     HelpWindow(void);
  247.     void packetlist(void);
  248.      void arealist(void);
  249.      void threadlist(void);
  250.      void letterlist(void);
  251.      void reply_area_letterlist(void);
  252.      void letter(void);
  253.      void reply_area_letter(void);
  254.      void Delete(void);
  255.      void redraw(void);
  256.  private:
  257.      WINDOW     *menu;
  258.     int     active;
  259. };
  260.  
  261. extern WINDOW *screen; 
  262.  
  263. #endif
  264.